package com.ronri.common;

import android.app.Activity;

/**
 * 文件：Test3.java
 * 包名：com.ronri.common;   --- 正式发布时需要修正
 * 说明：轮播组件
 * 作者：MS During
 * 日期：2017/4/27
 * 历史：
 */
public class PermissionManager {

    // 是否可以使用摄像头
    public static boolean IsUseCamera = false;
    public static boolean IsWriteStore = false;
    public static boolean IsReadStore = false;

    /****
     * 判断摄像头是否拥有权限
     * @param activity
     */
    public static void OpenCamera(Activity activity){
//        if (Build.VERSION.SDK_INT >= 23){
//            int checkCallPhonePermission = ContextCompat.(activity.getApplicationContext(), Manifest.permission.CAMERA);
//            if(checkCallPhonePermission != PackageManager.PERMISSION_GRANTED){
//                ActivityCompat.requestPermissions(activity, new String[]{Manifest.permission.CAMERA},222);
//                return;
//            }else{
//                IsUseCamera = true;
//            }
//        }else{
//            IsUseCamera = true;
//        }
    }

    /***
     * 判断磁盘读写权限是否拥有
     * @param activity
     */
    public static void OpenWriteStore(Activity activity)
    {
//        if (Build.VERSION.SDK_INT >= 23){
//            int checkCallPhonePermission = ContextCompat.checkSelfPermission(activity.getApplicationContext(), Manifest.permission.WRITE_EXTERNAL_STORAGE);
//            if(checkCallPhonePermission != PackageManager.PERMISSION_GRANTED){
//                ActivityCompat.requestPermissions(activity, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},223);
//                return;
//            }else{
//                IsWriteStore = true;
//            }
//        }else{
//            IsWriteStore = true;
//        }
    }

    public static void OpenReadStore(Activity activity){
//        if (Build.VERSION.SDK_INT >= 23){
//            int checkCallPhonePermission = ContextCompat.checkSelfPermission(activity.getApplicationContext(), Manifest.permission.READ_EXTERNAL_STORAGE);
//            if(checkCallPhonePermission != PackageManager.PERMISSION_GRANTED){
//                ActivityCompat.requestPermissions(activity, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},224);
//                IsReadStore =false;
//                return;
//            }else{
//                IsReadStore = true;
//            }
//        }else{
//            IsReadStore = true;
//        }
    }


}
